package dto

import (
	"github.com/gin-gonic/gin"
	"tino_manager/public"
)

type ActivityAddInput struct {
	Title   string `json:"title" gorm:"column:title;comment:活动标题" comment:"活动标题" validate:"required"`
	Type    uint8  `json:"type" gorm:"column:type;comment:发布类型 0图文发布 1链接号发布"`
	Source  string `json:"source" gorm:"column:source;comment:活动来源;" comment:"活动来源" validate:"required"`
	Link    string `json:"link" gorm:"column:link;comment:链接地址"`
	Images  string `json:"images" gorm:"column:images;comment:活动图片"`
	Content string `json:"content" gorm:"column:content;comment:活动正文" comment:"活动正文"`
	Text    string `json:"text" gorm:"column:text;comment:正文"`
	Sort    int    `json:"sort" gorm:"column:sort;comment:排序"`
}

func (params *ActivityAddInput) BindValidParam(c *gin.Context) error {
	return public.DefaultGetValidParams(c, params)
}

type ActivityPageInput struct {
	Type       string `json:"type" form:"type"`
	Title      string `json:"title" form:"title" comment:"标题"`
	PageSize   int    `json:"page_size" form:"page_size" comment:"每页数量" validate:"required,lte=20"`
	PageNumber int    `json:"page_number" form:"page_number" comment:"页码" validate:"required"`
}

func (params *ActivityPageInput) BindValidParam(c *gin.Context) error {
	return public.DefaultGetValidParams(c, params)
}

type ActivityInfo struct {
	Id        string `json:"id" form:"id"`
	Title     string `json:"title" gorm:"column:title;comment:活动标题" comment:"活动标题" validate:"required"`
	Type      uint8  `json:"type" gorm:"column:type;comment:发布类型 0图文发布 1链接号发布"`
	Source    string `json:"source" gorm:"column:source;comment:活动来源;" comment:"活动来源" validate:"required"`
	Link      string `json:"link" gorm:"column:link;comment:链接地址"`
	Images    string `json:"images" gorm:"column:images;comment:活动图片"`
	Content   string `json:"content" gorm:"column:content;comment:活动正文" comment:"活动正文"`
	Text      string `json:"text" gorm:"column:text;comment:正文"`
	Sort      int    `json:"sort" gorm:"column:sort;comment:排序"`
	Status    uint8  `json:"status"`
	CreatedAt string `json:"created_at" form:"created_at"`
}
type ActivityPageOutput struct {
	List  []ActivityInfo `json:"list"`
	Total int64          `json:"total"`
}
type ActivityDetailInput struct {
	Id string `json:"id" form:"id" comment:"活动id" validate:"required"`
}

func (params *ActivityDetailInput) BindValidParam(c *gin.Context) error {
	return public.DefaultGetValidParams(c, params)
}

type ActivityUpdateInput struct {
	Id      string `json:"id" form:"id" validate:"required"`
	Title   string `json:"title" gorm:"column:title;comment:活动标题" comment:"活动标题" validate:"required"`
	Type    uint8  `json:"type" gorm:"column:type;comment:发布类型 0图文发布 1链接号发布"`
	Source  string `json:"source" gorm:"column:source;comment:活动来源;" comment:"活动来源" validate:"required"`
	Link    string `json:"link" gorm:"column:link;comment:链接地址"`
	Images  string `json:"images" gorm:"column:images;comment:活动图片"`
	Content string `json:"content" gorm:"column:content;comment:活动正文" comment:"活动正文"`
	Text    string `json:"text" gorm:"column:text;comment:正文"`
	Sort    int    `json:"sort" gorm:"column:sort;comment:排序"`
}

func (params *ActivityUpdateInput) BindValidParam(c *gin.Context) error {
	return public.DefaultGetValidParams(c, params)
}

type ActivityUpdateStatusInput struct {
	Id     string `json:"id" form:"id" comment:"活动id" validate:"required"`
	Status uint8  `json:"status" form:"status"`
}

func (params *ActivityUpdateStatusInput) BindValidParam(c *gin.Context) error {
	return public.DefaultGetValidParams(c, params)
}
